package cn.ickck.law_paper_final.mapper;

import cn.ickck.law_paper_final.model.entity.HouseLoan;
import cn.ickck.law_paper_final.provider.CreditCardProvider;
import cn.ickck.law_paper_final.provider.HouseLoanProvider;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.UpdateProvider;

import java.util.List;

/**
 * @Author: ck
 * @Description:
 * @Date: Create in 19:42 2020/10/14
 */
public interface HouseLoanMapper {
    @Select("select * from house_loan")
    List<HouseLoan> findAll();


    @Select("select count(*) from house_loan")
    int count();

    @Select("select * from house_loan limit #{start},#{end}")
    List<HouseLoan> selectByPage(int start, int end);


    @Delete("delete from house_loan where id = #{id}")
    Integer deleteById(Integer id);


    Integer insert(HouseLoan houseLoan);

    @UpdateProvider(type = HouseLoanProvider.class,method = "updateHouseLoan")
    Integer update(HouseLoan houseLoan);

    @Select("select * from house_loan where name like  CONCAT('%',#{key},'%') or `key` = #{key}")
    List<HouseLoan> selectByNameOrKey(String key);


    @Delete("delete from house_loan where `key` = #{key}")
    void deleteByKey(String key);
}
